package com.chiwen.common.utils.http;

import cn.hutool.http.HttpRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;

public class CommonHttp {
    private static final Logger LOGGER = LoggerFactory.getLogger(HttpHelper.class);






    public static String sendPost(String url, String param,Map<String,String> header)
    {

        HttpRequest post = HttpRequest.post(url);
        post.header("Content-Type", "application/json");

        if(header!=null){
            for(String dataKey : header.keySet())
            {
                post.header(dataKey, header.get(dataKey));
            }
        }

        post.body(param);

        return post.execute().body();
    }

    public static String sendPostForm(String url, String param , String ip )
    {
        return HttpUtils.sendPost(url,param,ip);
    }




}
